#include <math.h>
#include "VectorOperations.h"
#include "Types.h"

TVector AddVectors(TVector VectorA, TVector VectorB)
{
	TVector ResultVector;
	ResultVector.x = VectorA.x+VectorB.x;
	ResultVector.y = VectorA.y+VectorB.y;
	return ResultVector;
}

TVector SubtractVectors(TVector VectorA, TVector VectorB)
{
	TVector ResultVector;
	ResultVector.x = VectorA.x-VectorB.x;
	ResultVector.y = VectorA.y-VectorB.y;
	return ResultVector;
}

double VectorSize(TVector Vector)
{
	return sqrt(Vector.x*Vector.x + Vector.y*Vector.y);
}

double CalculateDistance(TVector VectorA, TVector VectorB)
{
	return VectorSize(SubtractVectors(VectorA, VectorB));
	//return sqrt( pow((VectorA.x - VectorB.x), 2 ) + pow((VectorA.y - VectorB.y),2) ); 
}

TVector MultiplyVectorWithDouble(TVector Vector, double Double)
{
	Vector.x = Double*Vector.x;
	Vector.y = Double*Vector.y;
	return Vector;
}
